import React from "react";

export default function UserList({ list,listDelById,showDialog}) {
  return (
    <div>
      <div className="tr">
        <div className="td">编号</div>
        <div className="td">用户名</div>
        <div className="td">年龄</div>
        <div className="td">删除</div>
        <div className="td">编辑</div>
      </div>
      {list.map((item) => {
        return (
          <div className="tr" key={item.id}>
            <div className="td">{item.id}</div>
            <div className="td">{item.username}</div>
            <div className="td">{item.userage}</div>
            <div className="td" onClick={()=>{
                listDelById(item.id)
            }}>删除</div>
            <div className="td" onClick={()=>{
                    showDialog(item);
            }}>编辑</div>
          </div>
        );
      })}
    </div>
  );
}
